package Z.dailyExercise.holiday;

public class _374_猜数字大小 {
    /***
     * 基本的二分查找
     * 判断mid对应的数值 判断大还是小
     * 如果大 则在左区间
     * 如果小 则在右区间
     * @param n
     * @return
     */
    public int guessNumber(int n) {

        int low =0;
        int high = n;


        while (low<=high){
            int mid = low+(high-low)/2;
            if (guess(mid) >0){
                low= mid+1;

            }else if (guess(mid)<0){
                high = mid-1;
            }else {
                return mid;
            }
        }

        return low;

    }

    public int guess(int n){

        return 1;
    }


}
